/*
 * Copyright (c) 2019 Author: Fancyears Milos Malvis @1243093366@qq.com
 * ALL COPYRIGHT REVERSED.
 */

package com.fancyears.mq.callback;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: Fancyears Milos Malvis
 * @Date: Created in  2019/5/31 13:26
 * @Modified By:
 */
@Component
public class RabbitMqReturnCallback implements RabbitTemplate.ReturnCallback {
    /**
     * confirm-callback监听ack返回false，不管是否匹配到队列，都不会执行ReturnCallback.returnedMessage方法。
     * 因为exchange接收数据是否，此时还没走到推送数据到队列这一步，所以不会以失败处理
     *
     * @param message
     * @param replyCode
     * @param replyText
     * @param exchange
     * @param routingKey
     */
    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
        System.out.println("********************************************************");
        System.out.println("失败确认:" + message + " | " + replyCode + " | " + replyText + " | " + exchange + " | " + routingKey);
        System.out.println("********************************************************");

    }
}
